package com.xiaoxing.zhinenghuacangku_liaocheng.mvp.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.xiaoxing.zhinenghuacangku_liaocheng.di.component.DaggerLiaoCheng_ReturnLibraryMenuComponent;
import com.xiaoxing.zhinenghuacangku_liaocheng.di.module.LiaoCheng_ReturnLibraryMenuModule;
import com.xiaoxing.zhinenghuacangku_liaocheng.mvp.contract.LiaoCheng_ReturnLibraryMenuContract;
import com.xiaoxing.zhinenghuacangku_liaocheng.mvp.presenter.LiaoCheng_ReturnLibraryMenuPresenter;
import com.xiaoxing.zhinenghuacangku_liaocheng.R;
import com.xiaoxing.zhinenghuacangku_liaocheng.R2;

import butterknife.BindView;
import butterknife.OnClick;
import com.jess.arms.utils.CProgressDialogUtils;
import me.jessyan.armscomponent.commonres.utils.ToolbarUtils;
import me.jessyan.armscomponent.commonsdk.core.RouterHub;
import me.jessyan.armscomponent.commonsdk.utils.Utils;

import static com.jess.arms.utils.Preconditions.checkNotNull;


@Route(path = RouterHub.ZHI_NENG_HUA_CANG_KU_LIAO_CHENG_RETURN_LIBRARY_MENU_ACTIVITY)
public class LiaoCheng_ReturnLibraryMenuActivity extends BaseActivity
        <LiaoCheng_ReturnLibraryMenuPresenter> implements LiaoCheng_ReturnLibraryMenuContract.View {


    @BindView(R2.id.btn_ru_ku)
    Button btnRuKu;
    @BindView(R2.id.btn_tui_ku)
    Button btnTuiKu;

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerLiaoCheng_ReturnLibraryMenuComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .liaoCheng_ReturnLibraryMenuModule(new LiaoCheng_ReturnLibraryMenuModule(this))
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.zhi_neng_cang_ku_liao_cheng_activity_return_library_menu; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

        ToolbarUtils.initToolbarTitleBack(this, "退库");

    }


    @Override
    public void showLoading() {
        CProgressDialogUtils.showProgressDialog(this);
    }

    @Override
    public void hideLoading() {
        CProgressDialogUtils.cancelProgressDialog();

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }


    @OnClick({R2.id.btn_ru_ku, R2.id.btn_tui_ku})
    public void onViewClicked(View view) {
        int i = view.getId();
        if (i == R.id.btn_ru_ku) {
            Utils.navigation(LiaoCheng_ReturnLibraryMenuActivity.this, RouterHub.ZHI_NENG_HUA_CANG_KU_LIN_YI_STORAGE_ACTIVITY);
        } else if (i == R.id.btn_tui_ku) {
            Utils.navigation(LiaoCheng_ReturnLibraryMenuActivity.this, RouterHub.ZHI_NENG_HUA_CANG_KU_LIN_YI_RETURN_LIBRARY_ACTIVITY);
        }
    }
}
